﻿using System;
using System.IO;

namespace GameListEditor
{
    ///-------------------------------------------------------------------------------------------------
    /// <summary> Manager for application data. </summary>
    ///-------------------------------------------------------------------------------------------------
    public class AppDataMgr
    {
        #region Member Variables / Properties

        private const String DATABASE_FILE_NAME = "games.sqlite.db";
        private const String GLE_DIRECTORY_NAME = "GameListEditor";
        private const String SETTINGS_FILE_NAME = "settings.xml";

        #endregion

        #region General Methods

        ///-------------------------------------------------------------------------------------------------
        /// <summary> Gets the full datbase file path. </summary>
        /// <returns> The full datbase file path. </returns>
        ///-------------------------------------------------------------------------------------------------
        static public String GetFullDatbaseFilePath()
        {
            return (Path.Combine(GetApplicationFolder(), DATABASE_FILE_NAME));
        }

        ///-------------------------------------------------------------------------------------------------
        /// <summary> Gets the full temp list xml file path. </summary>
        /// <returns> The full temp list xml file path. </returns>
        ///-------------------------------------------------------------------------------------------------
        static public String GetNewTempListXMLFilePath()
        {
            return (Path.GetTempFileName());
        }

        ///-------------------------------------------------------------------------------------------------
        /// <summary> Gets the full settings file path. </summary>
        /// <returns> Full path to settings file. </returns>
        ///-------------------------------------------------------------------------------------------------
        static public String GetFullSettingsFilePath()
        {
            return (Path.Combine(GetApplicationFolder(), SETTINGS_FILE_NAME));
        }

        #endregion

        #region Private Helper Methods

        ///-------------------------------------------------------------------------------------------------
        /// <summary> Gets the configuration file location. </summary>
        /// <returns> The configuration file location. </returns>
        ///-------------------------------------------------------------------------------------------------
        static private String GetApplicationFolder()
        {
            return(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), GLE_DIRECTORY_NAME));
        }

        #endregion
    }
}
